<?php 
if(isset($_SESSION['login']))
{
	printf("
<SCRIPT LANGUAGE=\"JavaScript\">
document.location.href=\"index.php\"
</SCRIPT> 
	");
	exit();
}
else 
{
	if(isset($_POST['email']) && isset($_POST['password']))
	{
		$email = stripslashes($_POST['email']);
		$connexion = sql_connecter();
		$requete = "SELECT * FROM users WHERE email_user='$email'";
		$resultat = sql_executer($connexion, $requete);
		$ligne = sql_lire_ligne_objet($resultat);
		
		if($email == $ligne->email_user)
		{
			$_SESSION['login'] = $_POST['email'];
	printf("
		<SCRIPT LANGUAGE=\"JavaScript\">
		document.location.href=\"index.php\"
		</SCRIPT> 
	");
			
		}
		
	}
	
	
?>

<!-- Start: login-holder -->
<div id="login-holder">
	
	<!--  start loginbox ................................................................................. -->
	<div id="loginbox">
	
	<!--  start login-inner -->
	<div id="login-inner">
		<form method="post" action="">
			<label for="login">Nom d'utilisateur</label>
			<input type="text"  class="login-inp" id="login" name="email" />
			<br />		<br />
			<label for="password">Mot de passe</label>
			<input type="password" value="************"  onfocus="this.value=''" id="password" class="login-inp" name="password" />
		<br />		<br />
			<input type="checkbox" class="checkbox-size" id="login-check" /><label for="login-check">Se souvenir de moi</label>
		<br />		<br />		
			<input type="submit" class="submit-login"  />
		</form>
	</div>
 	<!--  end login-inner -->
	<div class="clear"></div>
	<a href="" class="forgot-pwd">Mot de passe oublié ?</a>
 </div>
 <!--  end loginbox -->
 
	<!--  start forgotbox ................................................................................... -->
	<div id="forgotbox">
		<div id="forgotbox-text">Envoyer votre email pour avoir un nouveau mot de passe.</div>
		<!--  start forgot-inner -->
		<div id="forgot-inner">
		<table border="0" cellpadding="0" cellspacing="0">
		<tr>
			<th>Adresse email:</th>
			<td><input type="text" value=""   class="login-inp" /></td>
		</tr>
		<tr>
			<th> </th>
			<td><input type="button" class="submit-login"  /></td>
		</tr>
		</table>
		</div>
		<!--  end forgot-inner -->
		<div class="clear"></div>
		<a href="" class="back-login">Revenir au login</a>
	</div>
	<!--  end forgotbox -->

</div>
<!-- End: login-holder -->
<?php } ?>